#include "SkinnedMeshRenderer.h"
#include "Transform.h"
#include "GameObject.h"
#include "Camera.h"

namespace DYEngine
{
	SkinnedMeshRenderer::SkinnedMeshRenderer() : Renderer(), mSkinnedMesh(nullptr)
	{

	}

	SkinnedMeshRenderer::~SkinnedMeshRenderer()
	{
		mSkinnedMesh = nullptr;
	}

	bool SkinnedMeshRenderer::IsSkinned()
	{
		return true;
	}

	void SkinnedMeshRenderer::Draw()
	{
		Transform* transform = mGameObject->GetTransform();
		glm::mat4 vpMat = Camera::GetMainCamera()->GetVPMatrix();
		glm::mat4 mMat = transform->GetMatrix();
		mMaterial->SetMat4("mMatrix", mMat);
		mMaterial->SetMat4("vpMatrix", vpMat);
		mMaterial->Setup();
		mSkinnedMesh->Draw();
	}

	void SkinnedMeshRenderer::Update()
	{

	}
}
